home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / djgpp / src / binutils.252 / gas / write.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-01  |  5.6 KB  |  180 lines

  1. /* write.h
  2.  
  3.    Copyright (C) 1987, 1992, 1993 Free Software Foundation, Inc.
  4.  
  5.    This file is part of GAS, the GNU Assembler.
  6.  
  7.    GAS is free software; you can redistribute it and/or modify
  8.    it under the terms of the GNU General Public License as published by
  9.    the Free Software Foundation; either version 2, or (at your option)
  10.    any later version.
  11.  
  12.    GAS is distributed in the hope that it will be useful,
  13.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.    GNU General Public License for more details.
  16.  
  17.    You should have received a copy of the GNU General Public License
  18.    along with GAS; see the file COPYING.  If not, write to
  19.    the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21. #ifndef TC_I960
  22. #ifdef hpux
  23. #define EXEC_MACHINE_TYPE HP9000S200_ID
  24. #endif
  25. #endif /* TC_I960 */
  26.  
  27. #ifndef LOCAL_LABEL
  28. #define LOCAL_LABEL(name) (name [0] == 'L' )
  29. #endif /* LOCAL_LABEL */
  30.  
  31. #ifndef FAKE_LABEL_NAME
  32. #define FAKE_LABEL_NAME "L0\001"
  33. #endif
  34.  
  35. #define S_LOCAL_NAME(s) (LOCAL_LABEL(S_GET_NAME(s)))
  36.  
  37. #include "bit_fix.h"
  38.  
  39. /*
  40.  * FixSs may be built up in any order.
  41.  */
  42.  
  43. struct fix
  44. {
  45.   /* These small fields are grouped together for compactness of
  46.      this structure, and efficiency of access on some architectures.  */
  47.  
  48.   /* pc-relative offset adjust */
  49.   char fx_pcrel_adjust;
  50.  
  51.   /* Is this a pc-relative relocation?  */
  52.   unsigned fx_pcrel : 1;
  53.  
  54.   /* Is this a relocation to a procedure linkage table entry?  If so,
  55.      some of the reductions we try to apply are invalid.  A better way
  56.      might be to represent PLT entries with different kinds of
  57.      symbols, and use normal relocations (with undefined symbols);
  58.      look into it for version 2.6.  */
  59.   unsigned fx_plt : 1;
  60.  
  61.   /* Is this value an immediate displacement?  */
  62. #ifdef TC_NS32K
  63.   /* The ns32k needs a 3 valued field here. This could no doubt be
  64.      satisfied by the tx_fix_data below.  */
  65.   unsigned fx_im_disp : 2;
  66. #else
  67.   unsigned fx_im_disp : 1;
  68. #endif
  69.  
  70.   /* This is a hack for the sequent support.
  71.      This probably can be folded into tc_fix_data, below.  */
  72.   unsigned fx_bsr : 1;
  73.  
  74.   /* A bit for the CPU specific code.
  75.      This probably can be folded into tc_fix_data, below.  */
  76.   unsigned fx_tcbit : 1;
  77.  
  78.   /* Has this relocation already been applied?  */
  79.   unsigned fx_done : 1;
  80.  
  81.   /* How many bytes are involved? */
  82.   short int fx_size;
  83.  
  84.   /* Which frag does this fix apply to?  */
  85.   fragS *fx_frag;
  86.  
  87.   /* Where is the first byte to fix up?  */
  88.   long fx_where;
  89.  
  90.   /* NULL or Symbol whose value we add in. */
  91.   symbolS *fx_addsy;
  92.  
  93.   /* NULL or Symbol whose value we subtract. */
  94.   symbolS *fx_subsy;
  95.  
  96.   /* Absolute number we add in. */
  97.   valueT fx_offset;
  98.  
  99.   /* Next fixS in linked list, or NULL.  */
  100.   struct fix *fx_next;
  101.  
  102.   /* If NULL, no bitfix's to do.  */
  103.   /* Only i960-coff and ns32k use this, and i960-coff stores an
  104.      integer.  This can probably be folded into tc_fix_data, below.  */
  105.   bit_fixS *fx_bit_fixP;
  106.  
  107. #ifdef BFD_ASSEMBLER
  108.   bfd_reloc_code_real_type fx_r_type;
  109. #else
  110. #ifdef NEED_FX_R_TYPE
  111.   /* Hack for machines where the type of reloc can't be
  112.      worked out by looking at how big it is.  */
  113.   int fx_r_type;
  114. #endif
  115. #endif
  116.  
  117.   /* This field is sort of misnamed.  It appears to be a sort of random
  118.      scratch field, for use by the back ends.  The main gas code doesn't
  119.      do anything but initialize it to zero.  The use of it does need to
  120.      be coordinated between the cpu and format files, though.  E.g., some
  121.      coff targets pass the `addend' field from the cpu file via this
  122.      field.  I don't know why the `fx_offset' field above can't be used
  123.      for that; investigate later and document. KR  */
  124.   valueT fx_addnumber;
  125.  
  126.   /* The location of the instruction which created the reloc, used
  127.      in error messages.  */
  128.   char *fx_file;
  129.   unsigned fx_line;
  130.  
  131.   /* Location where a backend can attach additional data
  132.      needed to perform fixups.  Used by both PA backends.  */
  133.   PTR tc_fix_data;
  134. };
  135.  
  136. typedef struct fix fixS;
  137.  
  138. #ifndef BFD_ASSEMBLER
  139. extern char *next_object_file_charP;
  140.  
  141. #ifndef MANY_SEGMENTS
  142. COMMON fixS *text_fix_root, *text_fix_tail;    /* Chains fixSs. */
  143. COMMON fixS *data_fix_root, *data_fix_tail;    /* Chains fixSs. */
  144. COMMON fixS *bss_fix_root, *bss_fix_tail;    /* Chains fixSs. */
  145. extern struct frag *text_last_frag;        /* Last frag in segment. */
  146. extern struct frag *data_last_frag;        /* Last frag in segment. */
  147. #endif
  148. COMMON fixS **seg_fix_rootP, **seg_fix_tailP;    /* -> one of above. */
  149. #endif
  150.  
  151. extern long string_byte_count;
  152. extern int section_alignment[];
  153.  
  154. bit_fixS *bit_fix_new PARAMS ((int size, int offset, long base_type,
  155.                    long base_adj, long min, long max, long add));
  156. void append PARAMS ((char **charPP, char *fromP, unsigned long length));
  157. void record_alignment PARAMS ((segT seg, int align));
  158. void write_object_file PARAMS ((void));
  159. void relax_segment PARAMS ((struct frag * seg_frag_root, segT seg_type));
  160.  
  161. void number_to_chars_littleendian PARAMS ((char *, valueT, int));
  162. void number_to_chars_bigendian    PARAMS ((char *, valueT, int));
  163.  
  164. #ifdef BFD_ASSEMBLER
  165. fixS *fix_new PARAMS ((fragS * frag, int where, int size,
  166.                symbolS * add_symbol, offsetT offset, int pcrel,
  167.                bfd_reloc_code_real_type r_type));
  168. fixS *fix_new_exp PARAMS ((fragS * frag, int where, int size,
  169.                expressionS *exp, int pcrel,
  170.                bfd_reloc_code_real_type r_type));
  171. #else
  172. fixS *fix_new PARAMS ((fragS * frag, int where, int size,
  173.                symbolS * add_symbol, offsetT offset, int pcrel,
  174.                int r_type));
  175. fixS *fix_new_exp PARAMS ((fragS * frag, int where, int size,
  176.                expressionS *exp, int pcrel, int r_type));
  177. #endif
  178.  
  179. /* end of write.h */
  180.